From 70847d980d267277546481ead555c89f7e04e862 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sat, 19 Sep 2015 14:07:04 -0400 Subject: [PATCH] Remove dependency on Source if we only want a Package As alluded to in the previous commit, we don't actually need a Source at all in order to be able to get a Package given a manifest and a config. --- src/cargo/core/package.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index 1860257ea..90c605512 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -4,12 +4,12 @@ use std::slice; use std::path::{Path, PathBuf}; use semver::Version; -use core::{Dependency, Manifest, PackageId, Registry, Target, Summary, Metadata}; +use core::{Dependency, Manifest, PackageId, SourceId, Registry, Target, Summary, Metadata}; +use ops; use core::dependency::SerializedDependency; use util::{CargoResult, graph, Config}; use rustc_serialize::{Encoder,Encodable}; use core::source::Source; -use sources::PathSource; /// Informations about a package that is available somewhere in the file system. /// @@ -60,9 +60,11 @@ impl Package { } pub fn for_path(manifest_path: &Path, config: &Config) -> CargoResult { - let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(), - config)); - source.root_package() + let path = manifest_path.parent().unwrap(); + let source_id = try!(SourceId::for_path(path)); + let (pkg, _) = try!(ops::read_package(&manifest_path, &source_id, + config)); + Ok(pkg) } pub fn dependencies(&self) -> &[Dependency] { self.manifest.dependencies() } -- 2.30.2